package com.czk.ssacharmemory.config;

import com.alibaba.cloud.ai.dashscope.api.DashScopeApi;
import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatModel;
import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatOptions;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: chenzhangkun
 * @CreateTime: 2025-10-14
 * @Description:
 * @Version: 1.0
 */
@Configuration
public class ChatModelConfig {


    /**
     * deepseek模型
     */
    private final String DEEPSEEK_MODEL = "deepseek-v3";
    /**
     * 千问模型
     */
    private final String QWEN_MODEL = "qwen-max";

    /**
     * deepeek模型
     *
     * @param dashScopeApi
     * @return
     */
    @Bean(name = "deepseek")
    public ChatModel deepseek(DashScopeApi dashScopeApi) {
        return DashScopeChatModel.builder()
                // 指定灵积api
                .dashScopeApi(dashScopeApi)
                // 指定模型
                .defaultOptions(DashScopeChatOptions.builder().withModel(DEEPSEEK_MODEL).build())
                .build();
    }

    /**
     * 千问模型
     *
     * @param dashScopeApi
     * @return
     */
    @Bean(name = "qwen")
    public ChatModel qwen(DashScopeApi dashScopeApi) {
        return DashScopeChatModel.builder()
                // 指定灵积api
                .dashScopeApi(dashScopeApi)
                // 指定模型
                .defaultOptions(DashScopeChatOptions.builder().withModel(QWEN_MODEL).build())
                .build();
    }


}
